<div>

	
	<h2>{{$group_info['BotGroup']['name']}}</h2>


	<p>{{$user['User']['username']}}邀请你一起来群里分享，需要都添加微分享助手为好友。</p>
    <p> <img src="{{$user['User']['avatar']}}"> </p>

	{{if $current_user_id == $group_info['BotGroup']['creator'] }}
	<p class="text-center"><a class="btn btn-primary" href="#">点击右上角邀请加入分享</a></p>

	{{else}}
	<p class="text-center"><a class="btn btn-primary" href="/bot_groups/apply_member/{{$group_info['BotGroup']['bot_id']}}/{{$group_info['BotGroup']['id']}}">申请加入</a></p>
	{{/if}}

	{{if $isWeixin}}
	<script src="http://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
	<script>

        wx.config({
            debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来，若要查看传入的参数，可以在pc端打开，参数信息会通过log打出，仅在pc端时才会打印。
            appId: "{{$signPackage['appId']}}", // 必填，公众号的唯一标识
            timestamp: {{$signPackage['timestamp']}}, // 必填，生成签名的时间戳
        	nonceStr: "{{$signPackage['nonceStr']}}", // 必填，生成签名的随机串
            signature: "{{$signPackage['signature']}}",// 必填，签名，见附录1
            jsApiList: ['onMenuShareTimeline','onMenuShareAppMessage','onMenuShareQQ','onMenuShareWeibo','onMenuShareQZone'] // 必填，需要使用的JS接口列表，所有JS接口列表见附录2
        });

        window.share_config = {
            "share": {
                "imgUrl": "http://image.135editor.com/files/users/240/2406855/201707/FOYzKXXc_aeVz.jpg",//分享图，默认当相对路径处理，所以使用绝对路径的的话，“http://”协议前缀必须在。
                "desc" : "微分享助手，最好用的社群工具。",//摘要,如果分享到朋友圈的话，不显示摘要。
                "title" : '{{$group_info['BotGroup']['username']}}邀请你一起来{{$group_info['BotGroup']['name']}}分享',//分享卡片标题
                "link": window.location.href,//分享出去后的链接，这里可以将链接设置为另一个页面。
                "success":function(){//分享成功后的回调函数
                },
                'cancel': function () {
                    // 用户取消分享后执行的回调函数
                }
            }
        };

        wx.ready(function(){
            wx.onMenuShareAppMessage(share_config.share);//分享给好友
            wx.onMenuShareTimeline(share_config.share);//分享到朋友圈
            wx.onMenuShareQQ(share_config.share);//分享给手机QQ
            wx.onMenuShareWeibo(share_config.share); //分享到微博
            wx.onMenuShareQZone(share_config.share); //分享到QQ空间
        });

	</script>

	{{/if}}

{{if $current_user_id == $group_info['BotGroup']['creator'] }}
<hr/>
	<h2>申请人员列表</h2>

    <?php  $group_id=$group_info['BotGroup']['id'];$bot_id =$group_info['BotGroup']['bot_id'];   ?>

	<table class="table">
		<portlet cache="no" limit="200" portlet="body" model="BotGroupMember" list_tpl="inner" conditions="bot_id=$bot_id&group_id=$group_id">
    	
					<tr><td>{{$item['nickname']}} </td>
                        <td>{{$item['user_id']}} </td>
					<td>{{$item['created']}} </td>
					<td>
						{{if $item['role'] == 0}} 
					<a target="_blank" class="btn btn-primary" href="/bot_groups/accept_member/{{$item['id']}}">通过</a>
						{{elseif $item['role'] >= 1}}
						<span style="color:green">已通过</span>
						{{else}}
						未通过
						{{/if}}


				</td></tr>
			</portlet>
	</table>
<p><br/></p><p><br/></p>
    <h2>直接添加人员</h2>
    <hr/>
    {{$this->Form->create('BotGroup',array('class'=>'form-horizontal','url'=>array('action'=>'addMember'),'role'=>'form'))}}
        <div class="form-group">
            <label class="col-sm-2 control-label" for="BotGroupName">群名</label>
            <div class="col-sm-9 controls">
                {{$this->Form->input('BotGroupMember.groupname',array('label'=>false,'div'=>false,'value'=>$group_info['BotGroup']['name'],'class'=>'form-control'))}}                
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label" for="BotGroupName">成员微信昵称</label>
            <div class="col-sm-9 controls">
                {{$this->Form->input('BotGroupMember.nickname',array('label'=>false,'div'=>false,'class'=>'form-control'))}}                
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label" for="BotGroupName">成员用户编号</label>
            <div class="col-sm-9 controls">
                {{$this->Form->input('BotGroupMember.user_id',array('label'=>false,'type'=>'text','div'=>false,'class'=>'form-control'))}}                
            </div>
        </div>

        {{$this->Form->hidden('BotGroupMember.bot_id',array('value'=>$group_info['BotGroup']['bot_id']))}}
        {{$this->Form->hidden('BotGroupMember.group_id',array('value'=>$group_info['BotGroup']['id']))}}
         {{$this->Form->hidden('BotGroupMember.role',array('value'=>1))}}

        <div class="form-group">
            <label class="col-sm-2 control-label" for="BotGroupName"></label>
            <div class="col-sm-9"><input class="btn btn-primary" type="submit" value="提交"></div>
        </div>
    </form>
{{/if}}

</div>
